package com.qianwei.footpath.manage;

import com.qianwei.footpath.bean.BodyCompositionData;
import com.qianwei.footpath.utils.TextToSpeechUtils;

import java.util.List;

public class DataManager {
    private static DataManager instance;
    private double heightResultValue;
    private double weightResultValue;
    private double bmiResultValue;
    private int heartRateResultValue;
    private int age = 30;
    private int sex = 1;
    private String weightCategory;
    private String bmiCategory;
    private BodyCompositionData bodyCompositionData;
    private List<Double> weights;
    private String imei;

    // 私有构造函数防止外部实例化
    private DataManager() {
    }

    // 获取单例实例
    public static synchronized DataManager getInstance() {
        if (instance == null) {
            instance = new DataManager();
        }
        return instance;
    }

    public static void setInstance(DataManager instance) {
        DataManager.instance = instance;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public String getImei() {
        return imei;
    }

    public void setBmiCategory(String bmiCategory) {
        this.bmiCategory = bmiCategory;
    }

    public String getBmiCategory() {
        return bmiCategory;
    }

    public void setWeights(List<Double> weights) {
        this.weights = weights;
    }

    public List<Double> getWeights() {
        return weights;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public int getSex() {
        return sex;
    }

    public int getAge() {
        return age;
    }

    public void setHeartRateResultValue(int heartRateResultValue) {
        this.heartRateResultValue = heartRateResultValue;
    }

    public int getHeartRateResultValue() {
        return heartRateResultValue;
    }

    public void setBodyCompositionData(BodyCompositionData bodyCompositionData) {
        this.bodyCompositionData = bodyCompositionData;
    }

    public BodyCompositionData getBodyCompositionData() {
        return bodyCompositionData;
    }

    public double getHeightResultValue() {
        return heightResultValue;
    }

    public void setHeightResultValue(double heightResultValue) {
        this.heightResultValue = heightResultValue;
    }

    public double getWeightResultValue() {
        return weightResultValue;
    }

    public void setWeightResultValue(double weightResultValue) {
        this.weightResultValue = weightResultValue;
    }

    public double getBmiResultValue() {
        return bmiResultValue;
    }

    public void setBmiResultValue(double bmiResultValue) {
        this.bmiResultValue = bmiResultValue;
    }

    public String getWeightCategory() {
        return weightCategory;
    }

    public void setWeightCategory(String weightCategory) {
        this.weightCategory = weightCategory;
    }

    // 清除所有数据
    public void clearAllData() {
        heightResultValue = 0;
        weightResultValue = 0;
        bmiResultValue = 0;
        bmiCategory = "";
        bodyCompositionData = null;
        weights = null;
        age = 0;
        sex = 0;
        weightCategory = "";
        heartRateResultValue = 0;
        SerialPortManager.getInstance(null).release();
    }
}
